﻿using Basic.FormGatewaryModular.Interface;
using Basic.FormRemoteModel;
using Basic.FormRemoteModel.PhysicalQuery;
using Basic.FormRemoteModel.PhysicalQuery.Model;

namespace Basic.FormGatewaryModular.Services
{
    internal class PhysicalQueryService : IPhysicalQueryService
    {
        public long Add ( PhysicalQueryAdd data )
        {
            return new AddPhysicalQuery
            {
                Datum = data
            }.Send();
        }
        public void SetSort ( KeyValuePair<long, int>[] sorts )
        {
            new SetPhysicalQuerySort
            {
                Sorts = sorts
            }.Send();
        }

        public void Delete ( long id )
        {
            new DeletePhysicalQuery
            {
                Id = id
            }.Send();
        }

        public PhysicalQueryDto Get ( long id )
        {
            return new GetPhysicalQuery
            {
                Id = id
            }.Send();
        }
        public PhysicalQueryData[] Gets ( long formId, LayoutLocation location )
        {
            return new GetPhysicalQuerys
            {
                FormId = formId,
                Location = location
            }.Send();
        }

        public PhysicalQueryBody GetBody ( long formId )
        {
            return new GetPhyQueryBody
            {
                FormId = formId,
            }.Send();
        }

        public bool Set ( long id, PhysicalQuerySet set )
        {
            return new SetPhysicalQuery
            {
                Id = id,
                Datum = set
            }.Send();
        }
    }
}
